import java.util.ArrayList;
import java.util.List;


public class Dormitory {

	// List is an interface.  ArrayList is a concrete class
	// that implements that interface.  This may look a little
	// odd now, but the Java idiom (way you do it) is to declare
	// Lists like I did below.
	private List<Person> personList = new ArrayList<Person>();
	private String name;
	private int sizeLimit;

	
	// Pass in a size limit when you create the Dormitory
	public Dormitory(String name, int sizeLimit) {
		this.name = name;
		this.sizeLimit = sizeLimit;
	}
	
	public void addPerson(Person person) {
		// check to see if the dorm is full
		if (personList.size() == sizeLimit) {
			// the dorm is already full, so throw an exception
			throw new RuntimeException("Dorm is already full, cannot add Person");
		}
		// add the Person to the internal list
		personList.add(person);
	}
	
	public int percentAvailable() {
		return (sizeLimit / personList.size()) * 10;
	}
	
	// get the list of people in the dorm
	public List<Person> getPersonList() {
		return personList;
	}
}
